import request from '../../utils/request.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isEmpty: false, //是否为空【是否有学习记录】
    studyProgresses: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onShow: function (options) {
    // 获取学习进度数据
    this.getStudyProgressData()
  },

  async getStudyProgressData() {
    const data = await request({ url: '/study/progress' })
    let message = data.message
    this.setData({
      isEmpty: message.length === 0,
      studyProgresses: message
    })
  }
})